package com.wang.code;

import java.util.Comparator;

public class UserComparator implements Comparator<User> {

	@Override
	public int compare(User o1, User o2) {
		if (o1.getName().length() > o2.getName().length()) {
			return 1;
		} else if (o1.getName().length() < o2.getName().length()){
			return -1;
		} else {
			if (o1.getHeight() > o2.getHeight()) {
				return -1;
			} else if (o1.getHeight() < o2.getHeight()){
				return 1;
			} else {
				return 0;
			}
		}
	}

}
